<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册账号</title>
	<style type="text/css">
	body {
		background-color: rgb(177, 208, 224);
		font: normal 12px Trebuchet MS;
		color: #000;
	}
	
	.roundedCorners {
		width: 220px;
		padding: 10px;
		background-color: #DDEEF6;
		box-shadow: 0px 0px 10px 0px #888888;
		border: 1px solid #DDEEF6;
		border-radius: 6px;
		margin: auto;
	}
	
	.roundedCorners-textbox {
		border: 1px solid #999;
		width: 160px;
	}

	.checkbox {
		margin-left: 30px;
		border: 1px solid #999;
		width: 20px;
	}
	#toast {   
		position: fixed; /* 固定位置 */  
		top: 50%;   
		left: 50%;   
		width: 160px;
		height: 35px;
		margin-left: -100px;   
		border: 1px solid #666;   
		background-color: #333333;   
		padding: 10px 10px 10px 10px;  
		line-height: 30px;
		text-align:center;
		color: #EEEEEE;
		border-radius: 5px;
		opacity: 0; /* 透明度，取值0.1~0.9 */  

	}
</style>
</head>
<script type="text/javascript" src="js/base.js" ></script>
<script>
	
	//请求地址 http://255.255.255.255/AJAX/weibo 请求多条微博记录
	//返回多条微博记录
	function loadData(){
		//动态执行代码,
		//eval("var a=10; var b=3; alert(a*b); ");
		var request = new XMLHttpRequest();
		request.open("get","http://10.9.166.55:8080/AJAX/weibo", true);
		request.onreadystatechange = function(){
			if(request.readyState == 4){
				
				//alert(request.responseText);
				//如果服务器返回的是严格按照JSON格式编写的字符串
				//那么.....
				//eval方法可以将一个 json格式的字符串，转换成为相应的JS对象
				var arr = eval(request.responseText);
				var table = document.getElementById("datalist");
				
				for(var i in arr){
					//alert(arr[i]);
					
					var tr = document.createElement("tr");
					var _id = document.createElement("td");
					_id.innerHTML = arr[i].id;
					var _content = document.createElement("td");
					_content.innerHTML = arr[i].content;
					var _comtcnt = document.createElement("td");
					_comtcnt.innerHTML = arr[i].comtcnt;
					var _likecnt = document.createElement("td");
					_likecnt.innerHTML = arr[i].likecnt;
					var _username = document.createElement("td");
					_username.innerHTML = arr[i].username;
					
					tr.appendChild(_id);
					tr.appendChild(_content);
					tr.appendChild(_comtcnt);
					tr.appendChild(_likecnt);
					tr.appendChild(_username);
					
					table.appendChild(tr);
				}
			}
		}
		request.send();
	}

</script>
<body>
	<button onclick="loadData()">加载</button>
	<table border=1 id="datalist"></table>
</body>
</html>










